<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">
		<title>忘记密码</title>
		<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no">
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="apple-mobile-web-app-status-bar-style" content="black">
		<link rel="stylesheet" href="../css/mui.min.css" />
		<link rel="stylesheet" href="../css/main.css" />
		<link rel="stylesheet" href="../css/mui.picker.css" />
		<link rel="stylesheet" href="../css/mui.poppicker.css" />
		<link rel="stylesheet" href="../css/feedback.css" />
		<!--图标-->
		<link rel="stylesheet" type="text/css" href="../css/icons-extra.css" />

		<style>
			.mui-input-group:first-child {
				margin-top: 20px;
			}
			
			.mui-input-group label {
				width: 22%;
			}
			
			.mui-input-row label~input,
			.mui-input-row label~select,
			.mui-input-row label~textarea {
				width: 78%;
				height: 0.9rem;
				font-size: 14px;
			}
			
			.mui-checkbox input[type=checkbox],
			.mui-radio input[type=radio] {
				top: 6px;
			}
			
			.mui-content-padded {
				margin-top: 25px;
			}
			
			.mui-input-group {
				background: none;
			}
			
			.mui-input-group:before,
			.mui-input-group:after {
				height: 0;
			}
			
			.mui-input-group input {
				background-color: #FFFFFF;
				width: 87%;
				border-radius: 25px;
				margin: 15px;
			}
			
			.mui-input-group .mui-input-row:after {
				height: 0;
			}
			
			.mui-input-group .mui-input-row {
				text-align: center;
			}
			
			.mui-input-group .mui-input-row {
				height: inherit;
			}
			
			p {
				font-size: 14px;
				margin-top: 20px;
				margin-bottom: 10px;
				color: #8f8f94;
			}
			
			p a {
				color: #000000;
				padding: 0 20px;
			}
			
			.mui-content {
				background: none;
			}
			
			#showUserPicker {
				float: inherit;
				width: 87%;
				padding: 10px 15px;
			}
			
			.mui-input-group label {
				position: absolute;
				top: 5px;
				left: -5px;
			}
			
			.mui-input-group img {
				width: 0.4rem;
				vertical-align: -webkit-baseline-middle;
				padding-top: 10px;
			}
			
			.mui-input-group input {
				background-color: #FFFFFF !important;
				width: 95% !important;
				border-radius: 25px !important;
				margin: 10px 0px 10px 0px!important;
				margin-top: 10px;
				padding-left: 55px !important;
				float: inherit !important;
			}
			
			#reg {
				padding: 10px;
				border-radius: 20px;
				width: 100%;
				margin: 0 auto;
				background-color: #718fbd;
				border: 1px solid #718fbd;
			}
			
			#reg span {
				font-size: 0.34rem;
			}
			
			.guo_num {
				position: relative;
			}
			
			.guo_numa {
				position: absolute;
				top: 25%;
				left: 65%;
				border-radius: 20px;
			}
			
			.yanzhengBtn {
				position: absolute;
				top: 20px;
				right: 35px;
				background: #a7bad6;
				border: 0;
				border-radius: 20px;
			}
		
		</style>
	</head>

	<body>
		<header class="mui-bar mui-bar-nav" style="padding-top:5%;">
			<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
			<h1 class="mui-title" id="ptitle">忘记密码</h1>
		</header>
		<div class="mui-content" id="content">
			<form class="mui-input-group">

				<div class="mui-input-row">
					<label><img src="../images/exit/sj.png" /></label>
					<input id='phoneNo' name='phoneNo' type="number" class="mui-input phoneNumber" placeholder="请输入手机号"></input>
				</div>
				<div class="mui-input-row guo_num">
					<label><img src="../images/exit/yzm.png" /></label>
					<input id='checkcode' name='' type="number" class="mui-input yanzhengma" placeholder="请输入验证码"><button type="button" class="guo_numa" id="yanzhengBtn" style="background-color:#a7bad6;color:#ffffff">获取验证码</button> </input>
				</div>
				<!--<div class="mui-input-row">
					<label><img src="../images/exit/mm.png" /></label>
					<input id='doublepassword' name='doublepassword' type="password" class="mui-input password" placeholder="请输入确认密码"></input>
				</div>-->
			</form>
			<div class="mui-content-padded">
				<button id='reg' class="mui-btn mui-btn-block mui-btn-primary "><span>下一步</span></button>
			</div>

		</div>
	</body>
	<script type="text/javascript" src="../js/mui.min.js"></script>
	<script type="text/javascript" src="../js/app.js"></script>
	<script type="text/javascript" src="../js/constants.js"></script>
	<script type="text/javascript" src="../js/sharemethods.js"></script>
	<script type="text/javascript" src="../js/xiangyingshi.js"></script>
	<script type="text/javascript" src="../js/jquery-3.1.1.min.js"></script>
	<script type="text/javascript" src="../js/json_time.js"></script>
	<script>
		mui.plusReady(function() {
			var topoffset = '45px';
			if(plus.navigator.isImmersedStatusbar()) { // 兼容immersed状态栏模式
				// 获取状态栏高度并根据业务需求处理，这里重新计算了子窗口的偏移位置
				topoffset = (Math.round(plus.navigator.getStatusbarHeight()) + 45) + 'px';
				document.querySelector("header").style.height = topoffset;
				document.querySelector("header").style.paddingTop = "20px";
				document.getElementById('content').style.paddingTop = (Math.round(plus.navigator.getStatusbarHeight()) + 45) + "px";
			}
			// 加载完毕后关闭等待框，并展示页面
			var currentView = plus.webview.currentWebview();
			currentView.show('slide-in-right', 200);
			plus.nativeUI.closeWaiting();

			mui(".mui-content").on("tap", "#reg", function() {
				var vc = $('#checkcode').val()
				var phone = $("#phoneNo").val();
				if(checkcode == "") {
					mui.toast('请填写验证码')
					return false;
				}
				var phone_validate = /1[3|5|7|8|]\d{9}/; //验证手机号码是否正确
				if(phone == "") {
					mui.toast('请填写手机号');
					plus.nativeUI.closeWaiting();
					return false;
				}

				var sussess = function(data) {
					var cr = data.cr;
					//服务器返回响应，根据响应结果，分析是否登录成功；
					if(cr) {
						mui.openWindow({
							url: 'set_newpws.html',
							id: 'set_newpws',

							show: {
								autoShow: false, //页面loaded事件发生后自动显示，默认为true
								event: 'loaded' //页面显示时机，默认为titleUpdate事件时显示
							},
							extras: {
								vc: vc,
								phone: phone
							},
							waiting: {
								autoShow: true //自动显示等待框，默认为true
							}
						});
						currentView.close(true)
					} else {
						mui.toast("验证码错误,请重新输入");
					}
				};

				url = crvcUrl + "?pn=" + phone + "&vc=" + vc
				commonHttpUtils(url, "get", {}, sussess, error);
			});
		});

		//倒计时
		var past_time = 0,
			begin_time = localStorage.getItem("begin_time"),
			daojishi_current = localStorage.getItem("miao");
		var daojishi2 = 60;
		$("#yanzhengBtn").on("click", function() {
			document.activeElement.blur();
			var phone = $("phoneNo").val();
			var phone_validate = /1[3|5|7|8|]\d{9}/; //验证手机号码是否正确
			time_current = date_All_format();
			localStorage.setItem("begin_time", date_All_format());
			if(phone == "") {
				mui.toast('请填写手机号')
				return false;
			}
			document.querySelector('#yanzhengBtn').setAttribute("class", "verification size12 mui-disabled");
			var pn = $("#phoneNo").val();
			var uid = plus.push.getClientInfo().clientid
			var url = appsendBackVerCodeUrl + '?uid=' + uid + '&pn=' + pn;
			var sussess = function(data) {
				//服务器返回响应，根据响应结果，分析是否登录成功；
				if(data.result == "sendfailed") {
					mui.toast("发送失败");
					document.querySelector('#yanzhengBtn').setAttribute("class", "verification size12");
					return false;
				}
				if(data.result == "non-existent") {
					mui.toast("该手机号不存在");
					return false;
				}
				if(data.result == "success") {
					mui.toast("验证码发送成功");
					var daojishi_interval = setInterval(function() {
						if(daojishi2 > 0) {
							document.querySelector('#yanzhengBtn').innerHTML = daojishi2 + "秒";
							document.querySelector('#yanzhengBtn').setAttribute("class", "verification size12 mui-disabled");
							daojishi2--;
							localStorage.setItem("miao", date_All_format());

						} else {
							document.querySelector('#yanzhengBtn').innerHTML = "获取验证码";
							document.querySelector('#yanzhengBtn').setAttribute("class", "verification size12");
							localStorage.clear();
							clearInterval(daojishi_interval);
							past_time = 0;
							daojishi2 = 60;
						}
					}, 1000);

				}
			};
			commonHttpUtils(url, "get", {}, sussess, error, true);
		});
	</script>

</html>